#pragma once

#include "stdafx.h"
#include "object.h"
#include "message.h"
#include <boost/shared_ptr.hpp>

class CTerminator :
	public CObject
{
public:
	CTerminator(int num = 5): counter(0), numiters(num) {};
	~CTerminator(void) {};

	virtual void parseMessage(Message& msg, vector<Message>& retMsg)
	{
		if(msg.MsgCode == MSG_TIMER)
		{
			counter++;
			if(counter==numiters)
			{
				Message m("Terminator", "Parser", MSG_EXIT);
				retMsg.push_back(m);
			}
		}
	}
private:
	int counter;
	const int numiters;
};
